/*
day351 
2020.8.13 
*/
#include<iostream>
#include<cstdlib>
#include<vector>
using namespace std;


class Solution1 {
public:
    int numOfSubarrays(vector<int>& arr) {
		int *tem=new int[arr.size()];
		tem[0]=arr[0]%2==0 ? 0 : 1;
		for(int i=1;i<arr.size();++i)
		{
			tem[i]=(arr[i]%2+tem[i-1])%2;
		}
		
		int res=0;
		for(int i=0;i<arr.size();++i)
		{
			if(tem[i]==1)
			{
				for(int j=0;j<i;++j)
				{
					if(tem[j]==0)
					{
						++res;
					}
				}
				++res;
			}
			else
			{
				for(int j=0;j<i;++j)
				{
					if(tem[j]==1)
					{
						++res;
					}
				}
			}
		}
		
		return res;
    }
};


class Solution {
public:
    int numOfSubarrays(vector<int>& arr) {
		int num_1=0,num_0=0;
		int res=0,cur=0;
		int MOD=1e9+7;
		for(int i=0;i<arr.size();++i)
		{
			cur=(cur+arr[i]%2)%2;
			if(cur==0)
			{
				res+=num_1;
				res%=MOD;
				num_0++;
			}
			else
			{
				res+=num_0;
				res%=MOD;
				res++;
				res%=MOD;
				num_1++;
			}
		}
		return res;
    }
};


int main()
{
	return 0;
}
